package com.szh.zx.gaoDingJavaBook.chapter8.four;

import java.util.ArrayList;
import java.util.List;

public class ListTest {
	public static void main(String[] args) {
		List books = new ArrayList();
		books.add("轻量级javaee企业级应用实战");
		books.add("疯狂java讲义");
		books.add("疯狂android讲义");
		System.out.println(books);
//		将新字符串对象插入在第二个位置
		books.add(1,new String("疯狂Ajax讲义"));
		for (int i = 0; i < books.size(); i++) {
			System.out.println(books.get(i));
		}
//		删除第三个元素
		books.remove(2);
		System.out.println(books);
//
		System.out.println("判断指定元素在list的位置："+books.indexOf(new String("疯狂Ajax讲义") ));
//		将第二个元素替换成新的字符串对象
		books.set(1,new String("疯狂java讲义"));
		System.out.println(books);











	}
}
